package com.damacheng009.future.alarm.crawler;

import java.util.List;

import org.nutz.json.Json;

import com.damacheng009.future.alarm.vo.KLineVo;

public class SinaFutureDayCrawler extends BaseCrawler {

	@Override
	public List<KLineVo> getKLines(String code) {
		this.url = "https://stock2.finance.sina.com.cn/futures/api/jsonp.php/var%20x=/InnerFuturesNewService.getDailyKLine?symbol=" + code;
		String str = wget(null);
		return Json.fromJsonAsList(KLineVo.class, str);
	}

	@Override
	protected String clean(String originString) {
		String tmp = originString.replace("/*<script>location.href='//sina.com';</script>*/", "")
				.replace("var _x=(", "");
		return tmp = tmp.substring(0, tmp.length() - 2).trim();
	}

}
